import 'package:city_corner/commons/global-var.dart';
import 'package:city_corner/providers/main-page/filter-panel/index.dart';
import 'package:flutter/material.dart';
import 'package:city_corner/main-page/filter-panel/dropdown-panel.dart';
import 'package:provider/provider.dart';
import 'list-item.dart';

class HouseList extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    return _HouseList();
  }
}

class _HouseList extends State<HouseList> {
  @override
  Widget build(BuildContext context) {
    widgetHeight['houseList'] = mediaSize(context).height -
        topMargin(context) -
        widgetHeight['bottomBar'] -
        widgetHeight['searchPanel'];
    return Container(
        height: widgetHeight['houseList'],
        child: Stack(
          children: [
            ListItem(),
            // 筛选栏展示和隐藏
            Consumer<FilterModel>(
              builder: (context, filter, child) {
                var curOpt =
                    Provider.of<FilterModel>(context, listen: false).curOpt;
                if (curOpt != '') {
                  return DropDownPanel(curOpt: curOpt);
                } else {
                  return SizedBox();
                }
              },
            )
          ],
        ));
  }
}
